# -*- coding: utf-8 -*-

from django.utils.encoding import smart_str, smart_unicode
from mongoengine.django.auth import User

from people.models import People

from models import Place
from forms import PlaceForm

from utils import __make_uid
from utils import __make_tags_list
from utils import __make_img_thumb

from codename_bamboo.preference import ONE_LONGITUDE
from codename_bamboo.preference import DEFAULT_RADIUS
from codename_bamboo.preference import DEFAULT_QUERY_LENGTH

def _get_gridfs_ids(photos):
    """
    Return an array if gridfs ids 
    based on given files objects array
    """
    ids = []
    for index in range(len(photos)):
        photo = photos[index]
        d = {'image':str(photo.image.grid_id)
            ,'thumb':str(photo.thumb.grid_id)
            ,'index': index
            }
        ids.append(d)

    return ids

